
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	
	<!-- END RIBBON -->
	<div class="content">
		<div class="panel panel-default panel-intro">
			<div class="panel-heading">
				<div class="panel-lead">
					<em>
						 维护公告管理
					</em>
					...
				</div>
			</div>

				
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<div class="widget-body no-padding">
							<div class="bootstrap-table">

								<div class="fixed-table-container">
									<div class="fixed-table-body">
										
											<form class="layui-form" >
												<div class="layui-form-item">
													<label class="layui-form-label">开始时间：</label>
													<div class="layui-input-block">
														<input type="text" id="start" class="layui-input" value="{$content.0}">
													</div>
												</div>
												<div class="layui-form-item">
													<label class="layui-form-label">结束时间：</label>
													<div class="layui-input-block">
														<input type="text" id="end" class="layui-input" value="{$content.1}">
													</div>
												</div>

												<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">维护内容：</label>
													<div class="layui-input-block">
														<textarea name="desc" class="layui-textarea" id="content">{$content.2}</textarea>
													</div>
												</div>

												{if condition="$adminController->vif('notice','upd')"}
												<div class="layui-form-item layui-form-text">
													<label class="layui-form-label"> </label>
														<div class="layui-input-block">
														<button type="button" id="prevstep" class="btn btn-sm btn-primary" style="display: inline-block;">确认提交</button>
													</div>
												</div>
												{/if}
											</form>

									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
layui.use(['form', 'laydate', 'layedit'], function(){
	var form = layui.form, laydate = layui.laydate, layedit = layui.layedit;
	laydate.render({
		elem: '#start',type: 'datetime'
	});
	laydate.render({
		elem: '#end',type: 'datetime'
	});
	//建立编辑器
	layedit.set({
		uploadImage: {
			url: '{:url("common/add_images")}'
		}
	});
	index = layedit.build('content');

	// 监听提交
	$("#prevstep").on('click', function(){
		var start   = $('#start').val();
		var end     = $('#end').val();
		var content = layedit.getContent(index);
		var data    = {'start':start, 'end':end, 'content':content};

		if (content == '') {
			$.thinkmimi({Content : '维护内容不能为空！', Type:2, Align:'right', OutTime:2000}); return false;
		}

		$.ajax({
			type: 'post',
			data: data,
			url: "{:url('notice/upd')}",
			success: function(data) {
				var array = eval('(' + data+ ')');
				if (array['code'] == '01') {
					$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				} else {
					$.thinkmimi({Content : array['msg'], Type:1, Align:'right', OutTime:2000});
					setTimeout(function(){window.location.href = "{:url('notice/index')}";},500); 
				}
			}
		});
	});
});
</script>